﻿<%@ Page Language="VB" %>
<%@ import Namespace="System.Net.Mail" %>
<%@ import Namespace="System.Net" %>
<script runat="server">

    Sub Button1_Click(sender As Object, e As EventArgs)
        Dim Message As MailMessage = New MailMessage()
        Message.To.Add(enderecodeemail.Text)
        Message.From = New MailAddress("ZT Representações Comerciais LTDA.<ztrep2@terra.com.br>")
        Message.Subject = Assunto.Text
        Message.Body = Texto.Text
        Erro.Text = "E-mail enviado."
        try
            Dim smtp As SmtpClient = New SmtpClient("smtp.rio.terra.com.br")
            smtp.Credentials = New NetworkCredential("ztrep2", "shalom")
            smtp.Send(Message)
        catch
            Erro.Text = "E-mail de destino inválido"
        end try
    End Sub
    
    Sub Page_Load()
        enderecodeemail.Text = Request("email")
        Para.Text = Request("razaosocial") & " &lt;" & Request("email") & "&gt;"
    End Sub

</script>
<html>
<head>
</head>
<body>
    <form runat="server">
        <table bordercolor="navajowhite" cellspacing="0" cellpadding="2" width="950" align="center" bgcolor="floralwhite">
            <tbody>
                <tr>
                    <td valign="center" align="middle" bgcolor="#ffdead" colspan="2">
                        <h2>E-mail 
                        </h2>
                    </td>
                </tr>
                <tr>
                    <td valign="top" align="middle">
                        <asp:Label id="Erro" runat="server" forecolor="Red"></asp:Label>
                        <br />
                        <br />
                        <table>
                            <tbody>
                                <tr>
                                    <td>
                                        Para:</td>
                                    <td>
                                        <asp:Label id="Para" runat="server"></asp:Label><asp:Label id="enderecodeemail" runat="server" visible="False"></asp:Label></td>
                                </tr>
                                <tr>
                                    <td>
                                        De:</td>
                                    <td>
                                        ZT Representações Comerciais LTDA. &lt;ztrep@terra.com.br&gt;</td>
                                </tr>
                                <tr>
                                    <td>
                                        Assunto:</td>
                                    <td>
                                        <asp:TextBox id="Assunto" runat="server" Columns="90"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        <p>
                                            <asp:TextBox id="Texto" runat="server" Columns="100" TextMode="MultiLine" Width="657px" Height="428px"></asp:TextBox>
                                        </p>
                                        <p>
                                            <asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="Enviar"></asp:Button>
                                        </p>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </td>
                </tr>
            </tbody>
        </table>
    </form>
</body>
</html>
